﻿using Liang.Model;
using Liang.Util;
using Liang.Util.Crypt;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace Client.Helper
{
    public static class AppHelper
    {
        static ICrypt crypt = new DESCrypt();
        /// <summary>
        /// 加密密码
        /// </summary>
        /// <returns></returns>
        public static string EncPassword(string strPassword)
        {
            try
            {
                return crypt.EncStr(strPassword, CryptConst.USER_PWD);
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(typeof(DESCrypt), e);
                throw e;
            }
        }

        /// <summary>
        /// 解密密码
        /// </summary>
        /// <param name="strPassword"></param>
        /// <returns></returns>
        public static string DecPassword(string strPassword)
        {
            try
            {
                return crypt.DecStr(strPassword, CryptConst.USER_PWD);
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(typeof(DESCrypt), e);
                throw e;
            }
        }
    }
}
